package com.derbysoft.dswitch.adapter.ihg.dswitch3.translate.impl;

import com.derbysoft.dswitch.adapter.ihg.dto.OTAHotelAvailRQ;
import com.derbysoft.dswitch.adapter.ihg.dswitch3.translate.Translator;
import com.derbysoft.dswitch.remote.hotel.dto.HotelReservationRequest;
import org.springframework.stereotype.Component;

/**
 * Created by: jason
 * Date: 2012-05-14
 */
@Component("hotelPreviewRQTranslatorV2")
public class HotelPreviewRQTranslatorV2Impl extends BaseTranslator
        implements Translator<HotelReservationRequest, OTAHotelAvailRQ, Void> {

    @Override
    public OTAHotelAvailRQ translate(HotelReservationRequest reservationRequest, Void aVoid) {
        OTAHotelAvailRQ hotelAvailabilityRequest = new OTAHotelAvailRQ();
        setRequestAttributes(hotelAvailabilityRequest, reservationRequest);
        String hotelPassport = reservationRequest.getHotelReservationRQ().getHotelReservation().getHotelCode();
        hotelAvailabilityRequest.setAvailRequestSegments(translateAvailRequestSegments(hotelPassport, reservationRequest));
        return hotelAvailabilityRequest;
    }
}
